<template>
  <div>
    <MyHeader
      title="购物车案例"
      backgroundColor="orange"
      color="white"
    ></MyHeader>
    <div class="main">
      <MyGoods v-for="obj in list" :key="obj.id" :obj="obj"></MyGoods>
    </div>
    <MyFooter :arr="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyFooter from "./components/MyFooter";
import MyGoods from "./components/MyGoods";
export default {
  components: {
    MyHeader,
    MyFooter,
    MyGoods,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.$axios({
      url: "https://www.escook.cn/api/cart",
    }).then((res) => {
      this.list = res.data.list;
    });
  },
};
</script>

<style scoped>
.main {
  padding: 40px 0 50px 0;
}
</style>
